package Demo02;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void reflectEnum() {
        Class<?> c = null;
        try {
            c = Class.forName("Demo02.TestEnum");
            Constructor<?> constructor = c.getDeclaredConstructor(String.class,int.class,int.class,String.class);
            constructor.setAccessible(true);
            TestEnum testEnum = (TestEnum) constructor.newInstance(1,"吆西",7,"七彩");
            System.out.println(testEnum);

        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e);
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
    public static void main(String[] args) {
        reflectEnum();
    }
}
